package pub.wkq.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Lambda1
 * Not Runnable
 * Lambda2
 * Not Callable
 * @author 王开琦
 */
public class LambdasAndMethodReferences {
    public static void main(String[] args) {
        ExecutorService exec = Executors.newCachedThreadPool();
        exec.submit(() -> System.out.println("Lambda1"));
        exec.submit(new NotRunnable()::go);
        exec.submit(()->{
            System.out.println("Lambda2");
            return 1;
        });
        exec.submit(new NotCallable()::get);
        exec.shutdown();

    }
}
class NotRunnable{
    public void go() {
        System.out.println("Not Runnable");
    }
}
class NotCallable{
    public Integer get() {
        System.out.println("Not Callable");
        return 1;
    }
}
